
<template>
<div class="nav-top">
    <!-- 这是顶部 -->
    <mt-header fixed title="VUE PROGECT" class="header">
		 <span  slot="left" @click="back" v-show="flag">
    <mt-button icon="back">返回</mt-button>
  </span>
	</mt-header>


    <!-- 这是内容区 -->
	<transition>
		<router-view class="body"></router-view>
	</transition>

    <!-- 这是底部 -->
    <nav class="mui-bar mui-bar-tab" fixed>
		<router-link class="mui-tab-item-my " to='/home'>
			<span class="mui-icon mui-icon-home"></span>
			<span class="mui-tab-label">首页</span>
		</router-link>
		<router-link class="mui-tab-item-my" to='/shoppingcar'>
			<span class="mui-icon mui-icon-extra mui-icon-extra-cart"><span class="mui-badge" id="badge">{{$store.getters.getCounts}}</span></span>
			<span class="mui-tab-label">购物车</span>
		</router-link>
		<router-link class="mui-tab-item-my" to='/search'>
			<span class="mui-icon mui-icon-search"></span>
			<span class="mui-tab-label">搜索</span>
		</router-link>
		<router-link class="mui-tab-item-my" to='/member'>
			<span class="mui-icon mui-icon-contact"></span>
			<span class="mui-tab-label">会员</span>
		</router-link>
	</nav>


    
</div>
</template>


<script>
export default {
	data:function (){
		return {
			flag:false
		}
	},
	methods:{
		back(){
			this.$router.back()
			console.log(this.$route)
		}
	},
	created:function (){
		// if(this.$route.path == "/home" ){
		// 	this.flag = false 
		// }else{
		// 	this.flag=true
		// }
			switch(this.$route.path){
				case "/home" :
				this.flag=false
				// break;
				case "/shoppingcar":
				this.flag=false
				// break;
				case "/search":
				this.flag=false
				// break;
				case "/member":
				this.flag=false
				break;
				default:
				this.flag=true;
				break;

			}




	},
	watch:{
		"$route.path":function (newVal){
			switch(newVal){
				case "/home" :
				this.flag=false
				// break;
				case "/shoppingcar":
				this.flag=false
				// break;
				case "/search":
				this.flag=false
				// break;
				case "/member":
				this.flag=false
				break;
				default:
				this.flag=true;
				break;

			}


			// if(newVal == "/home"  ){
			// 	this.flag=false
			// 	console.log(newVal)
			// }else{
			// 	this.flag=true;
			// }
		}
	}
}


</script>

<style scoped lang="scss">
// .mint-header {
	
// }

.body {
	z-index: 1;
	position: relative;
}
.header {
    background-color: #000;
	z-index: 2;
}
.mui-bar-tab .mui-tab-item-my.mui-active {
    color: rgb(255, 0, 76) ;
}
.mui-icon .mui-badge {
	background: rgb(255, 0, 76) ;
}
.nav-top {
	margin-top: 40px;
	overflow-x: hidden;
	margin-bottom: 64px;
	padding-top: 0.1px;
}

.v-enter {
	opacity: 0;
	transform: translate(100%)
}
.v-leave-to {
	opacity: 0;
	transform: translate(-100%);
	position: absolute
}
.v-enter-active,
.v-leave-active {
	transition: all 0.4s ease;
}

// tabbar样式
.mui-bar-tab .mui-tab-item-my.mui-active[data-v-5ef48958] {
    color: #ff004c;
}
.mui-bar-tab .mui-tab-item-my {
    display: table-cell;
    overflow: hidden;
    width: 1%;
    height: 50px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #929292;
}
.mui-bar-tab .mui-tab-item-my .mui-icon {
    top: 3px;
    width: 24px;
    height: 24px;
    padding-top: 0;
    padding-bottom: 0;
}
.mui-bar-tab .mui-tab-item-my .mui-icon ~ .mui-tab-label {
    font-size: 11px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}


</style>

